<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="author" content="Guillaume Laborde - Guillaume Lameyre" />
<link rel="stylesheet" media="screen" type="text/css" title="style" href="css/style.css" />
<title>ContactBook</title>
</head>

<body>

	<c:set var="account" value="${sessionScope.account}" />
	<c:set var="contact" value="${requestScope.contact}" />
	
	<c:if test="${empty account}">
		<c:redirect url="Index" />
	</c:if>
	
	<c:if test="${empty contact}">
		<c:redirect url="Contact" />
	</c:if>
		
	<div id="mainframe">
		<c:import url="include/privateBanner.html" />
		<h1>Information sur le contact</h1>
		<div id="content">
		
			<jsp:useBean id="contact" class="contactbook.model.Contact" scope="page" />
			
			<fieldset>
				<legend><img src="images/contact.png" alt="" /> <jsp:getProperty name="contact" property="firstName" /> <jsp:getProperty name="contact" property="lastName" /></legend>
				<div class="right">
					<form action="UpdateContact" method="POST" class="inline">
						<input type="image" src="images/contact_edit.png" alt="Modifier" title="Modifier" />
						<input type="hidden" name="contactId" value="<jsp:getProperty name="contact" property="id" />" />
					</form>
					<form action="DeleteContact" method="POST" class="inline">
						<input type="image" src="images/contact_delete.png" alt="Supprimer" title="Supprimer" />
						<input type="hidden" name="contactId" value="<jsp:getProperty name="contact" property="id" />" />
					</form>
				</div>

				<p>
					<c:set var="firstName" value="${contact.firstName}" />
					<c:if test="${not empty firstName}">
						Prénom : <jsp:getProperty name="contact" property="firstName" />
					</c:if>
				</p>
				
				<p>
					Nom : <jsp:getProperty name="contact" property="lastName" />
				</p>

				<p>
					<c:set var="group" value="${contact.group}" />
					<c:if test="${empty group}">
						<span class="warning">Ce contact n'est associé à aucun groupe</span>
					</c:if>
					<c:if test="${not empty group}">
						<jsp:useBean id="group" class="contactbook.model.Group" scope="page" />
						Ce contact fait partie du groupe <jsp:getProperty name="group" property="name" />
					</c:if>
				</p>
				
				<p>
					<c:set var="email" value="${contact.email}" />
					<c:if test="${not empty email}">
						<img src="images/arrow.png" alt="" title="" />Email : <jsp:getProperty name="contact" property="email" />
					</c:if>
				</p>
				
				<p>
					<c:set var="phoneNumber" value="${contact.phoneNumber}" />
					<c:if test="${not empty phoneNumber}">
						<img src="images/arrow.png" alt="" title="" />Téléphone : <jsp:getProperty name="contact" property="phoneNumber" />
					</c:if>
				</p>

				<p>
					<c:set var="address" value="${contact.address}" />
					<c:if test="${not empty address}">
						<img src="images/arrow.png" alt="" title="" />Adresse : <jsp:getProperty name="contact" property="address" />
					</c:if>
				</p>	
				
				<p>
					<c:set var="zipCode" value="${contact.zipCode}" />
					<c:if test="${zipCode != '0'}">
						<img src="images/arrow.png" alt="" title="" />Code postal : <jsp:getProperty name="contact" property="zipCode" />
					</c:if>
				</p>
				
				<p>
					<c:set var="town" value="${contact.town}" />
					<c:if test="${not empty town}">
						<img src="images/arrow.png" alt="" title="" />Ville : <jsp:getProperty name="contact" property="town" />
					</c:if>
				</p>
				
				<p>
					<c:set var="country" value="${contact.country}" />
					<c:if test="${not empty country}">
						<img src="images/arrow.png" alt="" title="" />Pays : <jsp:getProperty name="contact" property="country" />
					</c:if>
				</p>
				
				<p>
					<c:set var="maritalStatus" value="${contact.maritalStatus}" />
					<c:if test="${maritalStatus != 'NC'}">
						<img src="images/arrow.png" alt="" title="" />Situation familiale : <jsp:getProperty name="contact" property="maritalStatus" />
					</c:if>
				</p>
				
				<p>
					<c:set var="age" value="${contact.age}" />
					<c:if test="${age != '0'}">
						<img src="images/arrow.png" alt="" title="" />Age : <jsp:getProperty name="contact" property="age" /> ans
					</c:if>
				</p>
				
				<form action="Contact" method="POST">
					<table>
						<tr><td class="button"><input type="image" src="images/back.png" alt="Retour" /></td></tr>
					</table>
				</form>
			</fieldset>
		
		</div>
		<c:import url="include/bottom.html" />
	</div>

</body>
</html>